utils.on(tbody, 'click', function (e) {
    var target = e.target
    // 把classList转成数组，去验证是否存在某个元素
    if (Array.from(target.classList).includes('btn-edit')) {
        const tr = target.parentNode.parentNode
        const id = tr.getAttribute('data-id')
        const trSpans = tr.querySelectorAll("span")
        const trInputs = tr.querySelectorAll("input")
        tr.className = "edit"
        for(var i=0;i<3;i++){
            trInputs[i].value = trSpans[i].innerHTML
        }
        utils.on(tbody, 'click', function(e){
            var target = e.target
            const tr = target.parentNode.parentNode
            const name = trInputs[0].value
            const price = trInputs[1].value
            const num = trInputs[2].value
            if(Array.from(target.classList).includes('btn-ok')){
                utils.fetch('./api/shop/edit.php',{ id, name, price, num}).then(resp => {
                    console.log(resp)
                    if(resp.code === 200){
                        getList()
                    }
                })
            }
        })
        utils.on(tbody, 'click', function(e){
            var target = e.target
            if(Array.from(target.classList).includes('btn-cancel')){
                getList()
            }
        })
    }
})